const Koa = require('koa')
const bodyParser = require('koa-bodyparser')
const static = require('koa-static')
const path = require('path')
const app = new Koa()

/* bodyParser 解析参数 */
app.use(bodyParser())
/* 静态资源目录 */
const staticPath = './static'
app.use(static(
  path.join(__dirname, staticPath)
))

app.use(async ctx => {
  ctx.body = 'hello world!'
})

app.listen(4000, () => {
  console.log('[demo] request post is starting at port 4000')
})